<template>
    <span>
        <Button v-if="alarm_record.alarm_read != 1" size="small" @click="handleAlarmRecordRead(data)" style="margin-right: 5px;">标为已读</Button>
        <Button v-else type="text" size="small" disabled style="margin-right: 5px;">已读</Button>
    </span>
</template>

<script>
export default {
    name: "AlarmRecordReadButton",
    props: {
        data: Object
    },
    data() {
        return {
            alarm_record: this.data
        }
    },
    methods: {
        handleAlarmRecordRead(row) {
            this.$http.post('/alarm_record_read', {
                alarm_id: row.alarm_id
            }).then((res) => {
                if (res.status == 'ok') {
                    // this.$Message.success('标记成功');
                    row.alarm_read = 1;
                }
            });
        },
    }
}
</script>